home *** CD-ROM | disk | FTP | other *** search
- Path: news.global1.net!news
- From: youngrc@global1.net
- Newsgroups: comp.lang.c
- Subject: Variable blocks of binary data with VAX C?
- Date: 10 Feb 1996 01:44:51 GMT
- Organization: CMA Consulting Services
- Message-ID: <4fgtaj$cne@news.global1.net>
- NNTP-Posting-Host: ppp8.global1.net
- X-Newsreader: SPRY News 3.03 (SPRY, Inc.)
-
-
- The VAX C program is supposed to create an IBM formatted tape.
- The tape has to have a few header files, a tape mark, the EBCDIC
- data, a tape mark and a couple trailer records. The first two
- bytes of each block are the blocksize. The first two bytes of
- each record are the record size. The records are variable
- length. The maximum size of each block is 15,004.
-
- The VAX C program reads the EBCDIC records from a file using
- fscanf(), appends the record to the record size, and stores it in
- a character array until it gets close to the maximum block size.
- When the block is the correct size, the VAX C program appends the
- block to the blocksize and writes the EBCDIC character array to
- the tape using fputc(). And so on...
-
- It is possible for the block of data to contain a <LF> (0Ax)
- character. When VAX C program opens the tape file WITHOUT the
- "b" option on the fopen(), the VAX C program was writing a <LF>
- (0Ax) to the tape to end one variable length block and start the
- next. Of course, when there was a <LF> (0Ax) character IN the
- block of data that VAX C program was writing, the block on the
- tape would end and a new one would start. This is not correct.
-
- When VAX C program opens the tape file WITH the "b" option on the
- fopen(), the <LF> (0Ax) character in the block of data can be
- written as data. Now the VAX C program has no way to end a
- variable length block and start the next.
-
- Using the "b" option on the fopen() allows the VAX C program to
- write escape characters to the tape (which has to be done), but
- how is the end of block specified?
-
-
-
-
-
-
- Ron Young
- Consultant
- CMA Consulting Services
- youngrc@global1.net
-
-
-